//
//  ViewController.m
//  UI-02 Homework 完成登录-注册-忘记密码
//
//  Created by 冀永金 on 16/7/15.
//  Copyright © 2016年 冀永金. All rights reserved.
//

#import "ViewController.h"
#import "CustomView.h"
#import "SecondViewController.h"
#import "ThirdViewController.h"
@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self createFirstPage];
    // Do any additional setup after loading the view, typically from a nib.
}
- (void)createFirstPage {
    // 设置背景图片
    UIImageView *backGroundImage = [[UIImageView alloc]initWithFrame:self.view.frame];
    backGroundImage.image = [UIImage imageNamed:@"welcome_2"];
    [self.view addSubview:backGroundImage];
    backGroundImage.alpha = .7;
    UIImageView *imageOfLogo = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 100, 140)];
    [self.view addSubview:imageOfLogo];
    imageOfLogo.image = [UIImage imageNamed:@"logo_lagou"];
     [UIView animateWithDuration:2 animations:^{
         imageOfLogo.center = CGPointMake(self.view.frame.size.width / 2, 200);
         
     }];
    //封装的Image And TextField
    CustomView *viewOfUser = [[CustomView alloc]initWithFrame:CGRectMake(20, 300, self.view.frame.size.width - 40,55) leftImage:[UIImage imageNamed:@"1.png"] placeHolder:@"请输入已验证的手机号或邮箱"];
    [self.view addSubview:viewOfUser];
    CustomView *viewOfPassword = [[CustomView alloc]initWithFrame:CGRectMake(20, 360, self.view.frame.size.width - 40,55) leftImage:[UIImage imageNamed:@"2.png"] placeHolder:@"请输入密码"];
    [self.view addSubview:viewOfPassword];
    // 登录
    UIButton *buttonOfForget = [UIButton buttonWithType:UIButtonTypeSystem];
    [self.view addSubview:buttonOfForget];
    buttonOfForget.frame = CGRectMake(300, 415, 100, 50);
    [buttonOfForget setTitle:@"忘记密码" forState:UIControlStateNormal];
    [buttonOfForget setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    UIButton *buttonOfLogin = [UIButton buttonWithType:UIButtonTypeSystem];
    [self.view addSubview:buttonOfLogin];
    buttonOfForget.titleLabel.font = [UIFont systemFontOfSize:20];
    [buttonOfForget addTarget:self action:@selector(handleLook:) forControlEvents:UIControlEventTouchUpInside];
    buttonOfLogin.frame = CGRectMake(20, 485, self.view.frame.size.width - 40, 55);
    [buttonOfLogin setTitle:@"登录" forState:UIControlStateNormal];
    [buttonOfLogin setTitleColor:[UIColor colorWithRed:0.26 green:0.78 blue:0.66 alpha:1.00] forState:UIControlStateNormal];
    buttonOfLogin.backgroundColor = [UIColor colorWithRed:0.10 green:0.70 blue:0.54 alpha:1.00];
    buttonOfLogin.titleLabel.font = [UIFont systemFontOfSize:22];
    UIButton *buttonOfZhuce = [UIButton buttonWithType:UIButtonTypeSystem];
    [self.view addSubview:buttonOfZhuce];
    // 注册
    buttonOfZhuce.frame = CGRectMake(20, 550, self.view.frame.size.width - 40, 55);
    [buttonOfZhuce setTitle:@"注册拉勾" forState:UIControlStateNormal];
    [buttonOfZhuce setTitleColor:[UIColor colorWithRed:0.09 green:0.66 blue:0.51 alpha:1.00]forState:UIControlStateNormal];
    buttonOfZhuce.backgroundColor = [UIColor colorWithRed:0.23 green:0.27 blue:0.22 alpha:1.00];
    
    buttonOfZhuce.layer.borderColor = [UIColor colorWithRed:0.18 green:0.60 blue:0.48 alpha:1.00].CGColor;
    buttonOfZhuce.alpha = .7;
    buttonOfZhuce.titleLabel.font = [UIFont systemFontOfSize:22];
    [buttonOfZhuce.layer setMasksToBounds:YES];//设置按钮的圆角半径不会被遮挡
    
    [buttonOfZhuce.layer setCornerRadius:10];
    
    [buttonOfZhuce.layer setBorderWidth:2];//设置边界的宽度
    //设置按钮的边界颜色
    buttonOfZhuce.layer.borderColor = [UIColor colorWithRed:0.24 green:0.61 blue:0.48 alpha:1.00].CGColor;
//    CGColorSpaceRef colorSpaceRef = CGColorSpaceCreateDeviceRGB();
//    
//    CGColorRef color = CGColorCreate(colorSpaceRef, (CGFloat[]){1,0,0,1});
//    [buttonOfZhuce.layer setBorderColor:color];
//    
    
    [buttonOfZhuce addTarget:self action:@selector(handleZhuce:) forControlEvents:UIControlEventTouchUpInside];
}
- (void)handleZhuce:(UIButton *)button {
    SecondViewController *second = [[SecondViewController alloc]init];
    [self presentViewController:second animated:YES completion:^{
        
    }];
}
- (void)handleLook:(UIButton *)button {
    ThirdViewController *third = [[ThirdViewController alloc]init];
    [self presentViewController:third animated:YES completion:^{
        
    }];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
